#ifndef OBBBOXVISITOR_H
#define OBBBOXVISITOR_H
#include <Define.h>
#include <osg/NodeVisitor>
#include <osg/Matrix>
#include <vector>
class OSG_EDITOR_DLL OBBboxVisitor : public osg::NodeVisitor
{
public:
    OBBboxVisitor();
    virtual ~OBBboxVisitor();

    virtual void apply( osg::Node& node);
    virtual void apply( osg::MatrixTransform& node);
    virtual void apply( osg::Geode& node);

    osg::ref_ptr<osg::Node> getBoxMT();
protected:
    void updateCurrentMatrix();
    void updateBoxMT();
    void updateObbResult();
private:
    std::vector<osg::Matrix> m_matrixVector;
    osg::ref_ptr<osg::Vec3Array> m_vertexs;
    osg::Matrix m_currentMatrix;
    osg::ref_ptr<osg::MatrixTransform> m_boxMT;
    osg::ref_ptr<osg::Geode> m_boxGeode;
    osg::ref_ptr<osg::Vec3Array> m_obbResult;
    osg::ref_ptr<osg::Node> m_startNode;
};

#endif // OBBBOXVISITOR_H

